-
Notifications
You must be signed in to change notification settings - Fork 286
CLI: normalize lora.ignore_incoming IDs (dec/!hex/0x), dedupe, YAML [] clear, fix bytes→int crash #834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLI: normalize lora.ignore_incoming IDs (dec/!hex/0x), dedupe, YAML [] clear, fix bytes→int crash #834
Conversation
Signed-off-by: Niklas Roslund <[email protected]>
|
Is it possible to get a review on this PR or get it merged? Would be deeply appreciated! @ianmcorvidae |
|
Hi, I've been short on time lately but giving it a look now. It's worth noting that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good, one thing I'd like to see moved elsewhere. I'll keep an eye on this and probably merge it soon if you don't get back to it.
meshtastic/node.py
Outdated
| def _to_node_num(self, nodeId: Union[int, str]) -> int: | ||
| """Normalize node id from int | '!hex' | '0xhex' | 'decimal' to int.""" | ||
| if isinstance(nodeId, int): | ||
| return nodeId | ||
| s = str(nodeId).strip() | ||
| if s.startswith("!"): | ||
| s = s[1:] | ||
| if s.lower().startswith("0x"): | ||
| return int(s, 16) | ||
| try: | ||
| return int(s, 10) | ||
| except ValueError: | ||
| return int(s, 16) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this structure, but I think this function belongs in meshtastic.util, perhaps something like to_node_num there. (side note that most of the functions there are camelcase rather than underscores, but I think we may as well follow pep8 when we can).
Doesn't need to block merging, but if you're able to move this there that'd be appreciated!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has now been moved to util! Seems to be a bit of mixture between camelcase and underscores but i kept to_node_num.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
|
heh, I think that failure is due to another PR. I'm gonna merge it and fix locally if needed |
Fixes #833
Summary
!hex, and0xhex; normalize to int.lora.ignore_incomingon write.config.lora.ignore_incoming: []reliably.'bytes' object cannot be interpreted as an integer.Why
CLI operations around ignore list were brittle:
Behavior
--set lora.ignore_incoming <id>accepts dec/!hex/0xhex and stores one normalized entry.--get lora.ignore_incomingreflects deduped list.config.lora.ignore_incoming: []clears list.Notes
Firmware still shows packets in logs; enforcement is firmware-level and out of scope here.
No breaking changes—CLI becomes more permissive and robust.